<template>
  <li>
    <label>
<!--      <inpub type="checkbox" :checked="todo.done" @click="handleCheck(todo.id)"></inpub>-->
      <input type="checkbox" :checked="todo.done" @change="handleCheck(todo.id)"/>
      <span>{{ todo.title }}</span>
    </label>
    <button @click="deleteTodo">删除</button>
  </li>
</template>
<script>
export default {
  name: 'MyItem',
  props: ['todo','checkTodo','remove'],
  methods: {
    handleCheck(id) {
      // 通知app组件，将对应对应done值取反
      console.log('handleCheck'+id);
      this.checkTodo(id)
    },
    deleteTodo() {
      console.log(this.todo.id)
      this.remove(this.todo.id)
    }
  },

}
</script>